﻿using Engine;
using Game;

namespace Mekiasm
{
    public class ForgingHammer : ItemFlat
    {
        public static int Index;

        public ForgingHammer() : base("锻造锤", MekiasmInit.GetFlatTexture(MekiasmInit.R2, "forge_hammer"))
        {
        }

        public override string GetDescription(int value)
        {
            return "用于加工各种金属板和金属外壳，可使用64次。\n与金属锭合成一次变成金属板，再与金属板合成一次变成两个金属外壳。";
        }

        public override int GetBasePower()
        {
            return 64;
        }

        public override int GetMaxPower()
        {
            return 64;
        }
        public override int GetCraftedRemainValue(int value)
        {
            SaveItemSystem.GetBlockData(value, out var data);
            if (data != null)
            {
                return SaveItemSystem.ChangePower(value,-1);
            }
            return value;
        }
        public override int GetCraftedResultValue(int value)
        {
            return SaveItemSystem.StoreBlockData(value, GetMaxPower());
        }

        public override float GetBlockHealth(int value)
        {
            SaveItemSystem.GetBlockData(value, out var data);
            if (data == null) return -1f;
            else return data.fuelAmount / (float)GetMaxPower();
        }

        public override bool IsCrushWhenNoPower()
        {
            return true;
        }
        public override Vector3 GetIconViewOffset(int value, DrawBlockEnvironmentData environmentData)
        {
            return new Vector3(0f, 0f, 1f);
        }
    }
}